JBoss Community Archive (Read Only)

Mobicents

Sending JMX Notifications as SNMP Traps (or INFORMs)

Sending SNMP Trap from JBoss Application Server

When started the SNMP Adaptor sends a JMX Notification that is converted into an SNMP Trap, here is the excerpt of the SNMP Adaptor Notifications configuration File that is doing the conversion

 <mapping notification-type="jboss.snmp.agent.coldstart" generic="0" specific="0" enterprise="1.2.3.4.5.6.7" inform="false" security-name="TEST">    
    <var-bind-list wrapper-class="org.jboss.jmx.adaptor.snmp.agent.NotificationWrapperSupport">
      <var-bind tag="a:startTime" oid="1.2.3.4.5.6.7.9"/>
      <var-bind tag="a:trapCount" oid="1.2.3.4.5.6.7.6"/>      
    </var-bind-list>               
  </mapping>

When a JMX Notification is sent through JBoss Application Server, the SNMP Adaptor converts it with the SNMP Adaptor Notifications configuration File then the SNMP Trap (or INFORM if the inform attribute is set to "true") will be sent to each Manager defined in SNMP Adaptor Managers Configuration File

To test the reception of SNMP Trap, the snmptrap daemon needs to be started with the following command :

sudo snmptrapd -f -Lo

The following option -Dusm can be added to the above command for debugging user negotiation

Then when JBoss Application Server has been started, the following output can be seen on the console where snmptrapd was started

2011-07-12 22:18:19 localhost.localdomain \[UDP: \[127.0.0.1\]:1161->\[127.0.0.1\]\]:
iso.3.6.1.2.1.1.3.0 = Timeticks: (35) 0:00:00.35 iso.3.6.1.6.3.1.1.4.1.0 = OID: iso.2.3.4.5.6.7.0.0 iso.2.3.4.5.6.7.9 = STRING: "Tue Jul 12 22:18:18 CEST 2011" iso.2.3.4.5.6.7.6 = STRING: "0"

Sending SNMP Trap from your application

Exposing your Application metrics through SNMP details and provide the source code on how an application can use the same mechanism to send JMX Notifications that get converted to a SNMP Notification then sent out through the Managers defined in SNMP Adaptor Managers Configuration File

When started the application attached in Exposing your Application metrics through SNMP sends a JMX Notification that is converted into an SNMP Trap, here is the excerpt of the SNMP Adaptor Notifications configuration File that is doing the conversion from the JMX Notification sent by the application on startup to the SNMP Notification that is sent out

<?xml version="1.0"?>
<notification-map-list>
  <mapping notification-type="snmp.servlet.test.coldstart" generic="6" specific="10" enterprise="1.3.6.1.4.1.2312.100" security-name="TEST">
    <var-bind-list wrapper-class="org.jboss.jmx.adaptor.snmp.agent.NotificationWrapperSupport">
      <var-bind tag="u:startTime" oid="1.3.6.1.4.1.2312.100.10.1" type="OctetString"/>
    </var-bind-list>
  </mapping>
</notification-map-list>

To test the reception of SNMP Trap, the snmptrap daemon needs to be started with the following command :

sudo snmptrapd -f -Lo

The following option -Dusm can be added to the above command for debugging user negotiation

Then when the application has been started, the following output can be seen on the console where snmptrapd was started

2011-07-12 22:18:32 localhost.localdomain [UDP: [127.0.0.1]:1161->[127.0.0.1]]:
iso.3.6.1.2.1.1.3.0 = Timeticks: (14526) 0:02:25.26 iso.3.6.1.6.3.1.1.4.1.0 = OID: iso.3.6.1.4.1.2312.100.0.10 iso.3.6.1.4.1.2312.100.10.1 = STRING: "Tue Jul 12 22:18:32 CEST 2011"
JBoss.org Content Archive (Read Only), exported from JBoss Community Documentation Editor at 2020-03-11 11:41:58 UTC, last content change 2011-08-03 13:11:29 UTC.